//
//  TKL_homeDetailWebVC.m
//  TKL_EnPro
//
//  Created by 雅恩三河科技 on 2019/4/19.
//  Copyright © 2019年 MrZhang. All rights reserved.
//

//
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                  \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
//
//

#import "TKL_homeDetailWebVC.h"
#import "Head.h"
@interface TKL_homeDetailWebVC ()
@property (nonatomic,strong) UIView *toolV;
@property (nonatomic,strong) NSMutableArray *toolTitles;
@end

@implementation TKL_homeDetailWebVC
-(UIView *)toolV
{
    if (!_toolV) {
        _toolV = [UIView new];
        _toolV.backgroundColor = Main_Color_White;
        _toolV.width = WF_SCREEN_WIDTH;
        _toolV.height = WFCGFloatY(49);
        _toolV.y = WF_SCREEN_HEIGHT - _toolV.height-WF_TAB_SAFE_OFFSET;
        NSArray* arr=@[@"首页",@"返回",@"前进",@"刷新",@"关闭"];
        for (NSInteger i = 0; i < self.toolTitles.count; i++) {
            NSString *imgs = self.toolTitles[i];
            UIImage *img = [UIImage imageNamed:imgs];
            UIButton *btn = [UIButton new];
            btn.width = _toolV.width / self.toolTitles.count;
            btn.x=btn.width*i;
            btn.height = _toolV.height;
            btn.tag = i;
            [btn setImage:img forState:UIControlStateNormal];
            [btn setTitle:arr[i] forState:UIControlStateNormal];
            [btn setTitleColor:HEXCOLOR(@"#666666") forState:UIControlStateNormal];
            btn.titleLabel.font=SYSTEMFONT(13);
            [btn addTarget:self action:@selector(toolTap:) forControlEvents:UIControlEventTouchUpInside];
            [_toolV addSubview:btn];
        }
    }
    return _toolV;
}
-(NSMutableArray *)toolTitles
{
    if (!_toolTitles) {
        _toolTitles = [NSMutableArray new];
        [_toolTitles addObject:@"web_home"];
        [_toolTitles addObject:@"web_back"];
        [_toolTitles addObject:@"web_forword"];
        [_toolTitles addObject:@"web_fresh"];
        [_toolTitles addObject:@"web_close"];
    }
    return _toolTitles;
}
#pragma mark - event
-(void)toolTap:(UIButton *)sender
{
    NSInteger tag = sender.tag;
    if (0 == tag) {
        [self refresh];
    }else if (1 == tag) {
        [self.web goBack];
    }else if (2 == tag) {
        [self.web goForward];
    }else if (3 == tag) {
        [self.web reload];
    }else {
        [self refresh];
    }
}
#pragma mark - method
-(void)initilization
{
    //[super initilization];
    [self.view addSubview:self.toolV];
    
    UIView* view=[UIView new];
    view.backgroundColor = Main_Color_Red;
    view.width = WF_SCREEN_WIDTH;
    view.height = isiPhoneX?44:20;
    view.y =0;
    [self.view addSubview:view];
    self.web.scrollView.bounces=NO;
    self.view.backgroundColor = [UIColor whiteColor];
    // self.web.scrollView.contentInset = UIEdgeInsetsMake([self topShelterHeight] - 44, 0, self.toolV.height+WF_TAB_SAFE_OFFSET, 0);
    self.web.height=SCREEN_HEIGHT-([self topShelterHeight] - 44)-(self.toolV.height+WF_TAB_SAFE_OFFSET);
    self.web.y= isiPhoneX?44:20;
    [self.view addSubview:self.web];
    NSLog(@"end");
}
-(void)viewModelBand
{
    
}
-(void)reloadData
{
    
}
-(void)reloadView
{
    
}
#pragma mark - life
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initilization];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */
#pragma mark - delegate
//-(void)webViewDidFinishLoad:(UIWebView *)webView
//{
//    NSString *js = @"document.getElementsByClassName(\"header\")[0];";
//    NSString *color = [webView stringByEvaluatingJavaScriptFromString:js];
//    NSLog(@"js %@",color);
//}

@end


/*
 11111111111111111111111111111111111111001111111111111111111111111
 11111111111111111111111111111111111100011111111111111111111111111
 11111111111111111111111111111111100001111111111111111111111111111
 11111111111111111111111111111110000111111111111111111111111111111
 11111111111111111111111111111000000111111111111111111111111111111
 11111111111111111111111111100000011110001100000000000000011111111
 11111111111111111100000000000000000000000000000000011111111111111
 11111111111111110111000000000000000000000000000011111111111111111
 11111111111111111111111000000000000000000000000000000000111111111
 11111111111111111110000000000000000000000000000000111111111111111
 11111111111111111100011100000000000000000000000000000111111111111
 11111111111111100000110000000000011000000000000000000011111111111
 11111111111111000000000000000100111100000000000001100000111111111
 11111111110000000000000000001110111110000000000000111000011111111
 11111111000000000000000000011111111100000000000000011110001111111
 11111110000000011111111111111111111100000000000000001111100111111
 11111111000001111111111111111111110000000000000000001111111111111
 11111111110111111111111111111100000000000000000000000111111111111
 11111111111111110000000000000000000000000000000000000111111111111
 11111111111111111100000000000000000000000000001100000111111111111
 11111111111111000000000000000000000000000000111100000111111111111
 11111111111000000000000000000000000000000001111110000111111111111
 11111111100000000000000000000000000000001111111110000111111111111
 11111110000000000000000000000000000000111111111110000111111111111
 11111100000000000000000001110000001111111111111110001111111111111
 11111000000000000000011111111111111111111111111110011111111111111
 11110000000000000001111111111111111100111111111111111111111111111
 11100000000000000011111111111111111111100001111111111111111111111
 11100000000001000111111111111111111111111000001111111111111111111
 11000000000001100111111111111111111111111110000000111111111111111
 11000000000000111011111111111100011111000011100000001111111111111
 11000000000000011111111111111111000111110000000000000011111111111
 11000000000000000011111111111111000000000000000000000000111111111
 11001000000000000000001111111110000000000000000000000000001111111
 11100110000000000001111111110000000000000000111000000000000111111
 11110110000000000000000000000000000000000111111111110000000011111
 11111110000000000000000000000000000000001111111111111100000001111
 11111110000010000000000000000001100000000111011111111110000001111
 11111111000111110000000000000111110000000000111111111110110000111
 11111110001111111100010000000001111100000111111111111111110000111
 11111110001111111111111110000000111111100000000111111111111000111
 11111111001111111111111111111000000111111111111111111111111100011
 11111111101111111111111111111110000111111111111111111111111001111
 11111111111111111111111111111110001111111111111111111111100111111
 11111111111111111111111111111111001111111111111111111111001111111
 11111111111111111111111111111111100111111111111111111111111111111
 11111111111111111111111111111111110111111111111111111111111111111
 
 
 */
